package com.fr.base.core.image4j.codec.ico;

import com.fr.base.core.image4j.io.LittleEndianInputStream;
import com.fr.base.core.image4j.io.LittleEndianOutputStream;
import java.io.IOException;

public class IconEntry
{
  public int bWidth;
  public int bHeight;
  public int bColorCount;
  public byte bReserved;
  public short sPlanes;
  public short sBitCount;
  public int iSizeInBytes;
  public int iFileOffset;

  public IconEntry(LittleEndianInputStream paramLittleEndianInputStream)
    throws IOException
  {
    this.bWidth = paramLittleEndianInputStream.readUnsignedByte();
    this.bHeight = paramLittleEndianInputStream.readUnsignedByte();
    this.bColorCount = paramLittleEndianInputStream.readUnsignedByte();
    this.bReserved = paramLittleEndianInputStream.readByte();
    this.sPlanes = paramLittleEndianInputStream.readShortLE();
    this.sBitCount = paramLittleEndianInputStream.readShortLE();
    this.iSizeInBytes = paramLittleEndianInputStream.readIntLE();
    this.iFileOffset = paramLittleEndianInputStream.readIntLE();
  }

  public IconEntry()
  {
    this.bWidth = 0;
    this.bHeight = 0;
    this.bColorCount = 0;
    this.sPlanes = 1;
    this.bReserved = 0;
    this.sBitCount = 0;
    this.iSizeInBytes = 0;
    this.iFileOffset = 0;
  }

  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append("width=");
    localStringBuffer.append(this.bWidth);
    localStringBuffer.append(",height=");
    localStringBuffer.append(this.bHeight);
    localStringBuffer.append(",bitCount=");
    localStringBuffer.append(this.sBitCount);
    localStringBuffer.append(",colorCount=" + this.bColorCount);
    return localStringBuffer.toString();
  }

  public void write(LittleEndianOutputStream paramLittleEndianOutputStream)
    throws IOException
  {
    paramLittleEndianOutputStream.writeByte(this.bWidth);
    paramLittleEndianOutputStream.writeByte(this.bHeight);
    paramLittleEndianOutputStream.writeByte(this.bColorCount);
    paramLittleEndianOutputStream.writeByte(this.bReserved);
    paramLittleEndianOutputStream.writeShortLE(this.sPlanes);
    paramLittleEndianOutputStream.writeShortLE(this.sBitCount);
    paramLittleEndianOutputStream.writeIntLE(this.iSizeInBytes);
    paramLittleEndianOutputStream.writeIntLE(this.iFileOffset);
  }
}